package com.yazi.mxz.person.jackson.filter;

import java.util.HashSet;
import java.util.Set;

import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.yazi.mxz.common.entity.beans.GoodsClassify;
import com.yazi.mxz.common.jackson.as.GoodsClassifyAs;

public abstract class GoodsClassifyFilter {

	public static FilterProvider getWithGoodsClassify() {
		final Set<String> classify = new HashSet<String>();
		classify.add("classifyId");
		classify.add("deep");
		classify.add("goodsClassify");
		classify.add("name");
		classify.add("pic");
		final Set<String> parent = new HashSet<String>();
		parent.add("classifyId");
		parent.add("deep");
		parent.add("name");
		parent.add("pic");
		

		return new SimpleFilterProvider().addFilter(
				GoodsClassify.class.getSimpleName(),
				SimpleBeanPropertyFilter.filterOutAllExcept(classify)).addFilter(
				GoodsClassifyAs.class.getSimpleName(),
				SimpleBeanPropertyFilter.filterOutAllExcept(parent));
	}
	
	public static FilterProvider getWithGoodsClassifies() {
		final Set<String> classify = new HashSet<String>();
		classify.add("classifyId");
		classify.add("deep");
		classify.add("goodsClassifies");
		classify.add("name");
		classify.add("pic");
		final Set<String> sons = new HashSet<String>();
		sons.add("classifyId");
		sons.add("deep");
		sons.add("name");
		sons.add("pic");
		
		return new SimpleFilterProvider().addFilter(
				GoodsClassify.class.getSimpleName(),
				SimpleBeanPropertyFilter.filterOutAllExcept(classify)).addFilter(
				GoodsClassifyAs.class.getSimpleName(),
				SimpleBeanPropertyFilter.filterOutAllExcept(sons));
	}

}
